If you repeatedlly select the door at the position in the middle for every try, then the number of tries entail:
n | base-2 log ofn |
---|---|
1 | 0 |
2 | 1 |
4 | 2 |
8 | 3 |
16 | 4 |
32 | 5 |
64 | 6 |
128 | 7 |
256 | 8 |
512 | 9 |
1,024 | 10 |
1,048,576 | 20 |
2,097,152 | 21 |
For a better explanation: Binary Search